

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>last_epoch_started &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../../_static/css/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="../../../_static/favicon.ico"/>
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../../" src="../../../_static/documentation_options.js"></script>
        <script src="../../../_static/jquery.js"></script>
        <script src="../../../_static/underscore.js"></script>
        <script src="../../../_static/doctools.js"></script>
    
    <script type="text/javascript" src="../../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../../genindex/" />
    <link rel="search" title="Search" href="../../../search/" />
    <link rel="next" title="Log Based PG" href="../log_based_pg/" />
    <link rel="prev" title="ECBackend 实现策略" href="../erasure_coding/ecbackend/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    

















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="../../../" class="icon icon-home"></a> &raquo;</li>
        
          <li><a href="../../internals/">Ceph 内幕</a> &raquo;</li>
        
          <li><a href="../">OSD 开发者文档</a> &raquo;</li>
        
      <li>last_epoch_started</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="../../../_sources/dev/osd_internals/last_epoch_started.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../../">
          

          
            
            <img src="../../../_static/logo.png" class="logo" alt="Logo"/>
          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../start/intro/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../radosgw/">Ceph 对象网关</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../developer_guide/">开发者指南</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../internals/">Ceph 内幕</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../blkin/">Tracing Ceph With LTTng</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../blkin/#tracing-ceph-with-blkin">Tracing Ceph With Blkin</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../bluestore/">BlueStore Internals</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cache-pool/">Cache pool</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../ceph_krb_auth/">如何配置好 Ceph Kerberos 认证的详细文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cephfs-mirroring/">CephFS Mirroring</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cephfs-reclaim/">CephFS Reclaim Interface</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cephfs-snapshots/">CephFS 快照</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cephx/">Cephx</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cephx_protocol/">Cephx 认证协议详细阐述</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config/">配置管理系统</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../config-key/">config-key layout</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../context/">CephContext</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../continuous-integration/">Continuous Integration Architecture</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../corpus/">资料库结构</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cpu-profiler/">Oprofile 的安装</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../cxx/">C++17 and libstdc++ ABI</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../deduplication/">去重</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../delayed-delete/">CephFS delayed deletion</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev_cluster_deployement/">开发集群的部署</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../dev_cluster_deployement/#id5">在同一机器上部署多套开发集群</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../development-workflow/">开发流程</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../documenting/">为 Ceph 写作文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../encoding/">序列化（编码、解码）</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../erasure-coded-pool/">纠删码存储池</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../file-striping/">File striping</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../freebsd/">FreeBSD Implementation details</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../generatedocs/">Ceph 文档的构建</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../health-reports/">Health Reports</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../iana/">IANA 号</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../kubernetes/">Hacking on Ceph in Kubernetes with Rook</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../libs/">库体系结构</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../logging/">集群日志的用法</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../logs/">调试日志</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../macos/">在 MacOS 上构建</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../messenger/">Messenger notes</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mon-bootstrap/">Monitor bootstrap</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mon-elections/">Monitor Elections</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mon-on-disk-formats/">ON-DISK FORMAT</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../mon-osdmap-prune/">FULL OSDMAP VERSION PRUNING</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../msgr2/">msgr2 协议（ msgr2.0 和 msgr2.1 ）</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../network-encoding/">Network Encoding</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../network-protocol/">网络协议</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../object-store/">对象存储架构概述</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../osd-class-path/">OSD class path issues</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../peering/">互联</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../perf/">Using perf</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../perf_counters/">性能计数器</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../perf_histograms/">Perf histograms</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../placement-group/">PG （归置组）说明</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../quick_guide/">开发者指南（快速）</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rados-client-protocol/">RADOS 客户端协议</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rbd-diff/">RBD 增量备份</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rbd-export/">RBD Export &amp; Import</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../rbd-layering/">RBD Layering</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../release-checklists/">Release checklists</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../release-process/">Ceph Release Process</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../seastore/">SeaStore</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../sepia/">Sepia 社区测试实验室</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../session_authentication/">Session Authentication for the Cephx Protocol</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../testing/">测试笔记</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../versions/">Public OSD Version</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../vstart-ganesha/">NFS CephFS-RGW Developer Guide</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../wireshark/">Wireshark Dissector</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../zoned-storage/">Zoned Storage Support</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../">OSD 开发者文档</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../async_recovery/">异步恢复</a></li>
<li class="toctree-l3"><a class="reference internal" href="../backfill_reservation/">Backfill Reservation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../erasure_coding/">纠删码编码的归置组</a></li>
<li class="toctree-l3 current"><a class="current reference internal" href="#">last_epoch_started</a></li>
<li class="toctree-l3"><a class="reference internal" href="../log_based_pg/">Log Based PG</a></li>
<li class="toctree-l3"><a class="reference internal" href="../manifest/">Manifest</a></li>
<li class="toctree-l3"><a class="reference internal" href="../map_message_handling/">Map and PG Message handling</a></li>
<li class="toctree-l3"><a class="reference internal" href="../mclock_wpq_cmp_study/">QoS Study with mClock and WPQ Schedulers</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd_overview/">OSD</a></li>
<li class="toctree-l3"><a class="reference internal" href="../osd_throttles/">OSD 油门（ throttle ）</a></li>
<li class="toctree-l3"><a class="reference internal" href="../partial_object_recovery/">Partial Object Recovery</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pg/">PG</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pg_removal/">PG Removal</a></li>
<li class="toctree-l3"><a class="reference internal" href="../pgpool/">PGPool</a></li>
<li class="toctree-l3"><a class="reference internal" href="../recovery_reservation/">Recovery Reservation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../refcount/">Refcount</a></li>
<li class="toctree-l3"><a class="reference internal" href="../scrub/">Scrub internals and diagnostics</a></li>
<li class="toctree-l3"><a class="reference internal" href="../snaps/">快照</a></li>
<li class="toctree-l3"><a class="reference internal" href="../stale_read/">Preventing Stale Reads</a></li>
<li class="toctree-l3"><a class="reference internal" href="../watch_notify/">关注通知</a></li>
<li class="toctree-l3"><a class="reference internal" href="../wbthrottle/">回写抑制</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../../mds_internals/">MDS 开发者文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../radosgw/">RADOS 网关开发者文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../ceph-volume/">ceph-volume 开发者文档</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../crimson/">Crimson developer documentation</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <div class="section" id="last-epoch-started">
<h1>last_epoch_started<a class="headerlink" href="#last-epoch-started" title="Permalink to this headline">¶</a></h1>
<p><code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> records an activation epoch <code class="docutils literal notranslate"><span class="pre">e</span></code> for interval <code class="docutils literal notranslate"><span class="pre">i</span></code>
such that all writes committed in <code class="docutils literal notranslate"><span class="pre">i</span></code> or earlier are reflected in the
local info/log and no writes after <code class="docutils literal notranslate"><span class="pre">i</span></code> are reflected in the local
info/log.  Since no committed write is ever divergent, even if we
get an authoritative log/info with an older <code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code>,
we can leave our <code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> alone since no writes could
have committed in any intervening interval (See PG::proc_master_log).</p>
<p><code class="docutils literal notranslate"><span class="pre">info.history.last_epoch_started</span></code> records a lower bound on the most
recent interval in which the PG as a whole went active and accepted
writes.  On a particular OSD it is also an upper bound on the
activation epoch of intervals in which writes in the local PG log
occurred:  we update it before accepting writes.  Because all
committed writes are committed by all acting set OSDs, any
non-divergent writes ensure that <code class="docutils literal notranslate"><span class="pre">history.last_epoch_started</span></code> was
recorded by all acting set members in the interval.  Once peering has
queried one OSD from each interval back to some seen
<code class="docutils literal notranslate"><span class="pre">history.last_epoch_started</span></code>, it follows that no interval after the max
<code class="docutils literal notranslate"><span class="pre">history.last_epoch_started</span></code> can have reported writes as committed
(since we record it before recording client writes in an interval).
Thus, the minimum <code class="docutils literal notranslate"><span class="pre">last_update</span></code> across all infos with
<code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span> <span class="pre">&gt;=</span> <span class="pre">MAX(history.last_epoch_started)</span></code> must be an
upper bound on writes reported as committed to the client.</p>
<p>We update <code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> with the initial activation message,
but we only update <code class="docutils literal notranslate"><span class="pre">history.last_epoch_started</span></code> after the new
<code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> is persisted (possibly along with the first
write).  This ensures that we do not require an OSD with the most
recent <code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> until all acting set OSDs have recorded
it.</p>
<p>In <code class="docutils literal notranslate"><span class="pre">find_best_info</span></code>, we do include <code class="docutils literal notranslate"><span class="pre">info.last_epoch_started</span></code> values when
calculating <code class="docutils literal notranslate"><span class="pre">max_last_epoch_started_found</span></code> because we want to avoid
designating a log entry divergent which in a prior interval would have
been non-divergent since it might have been used to serve a read.  In
<code class="docutils literal notranslate"><span class="pre">activate()</span></code>, we use the peer’s <code class="docutils literal notranslate"><span class="pre">last_epoch_started</span></code> value as a bound on
how far back divergent log entries can be found.</p>
<p>However, in a case like</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">calc_acting</span> <span class="n">osd</span><span class="mf">.0</span> <span class="mf">1.4</span><span class="n">e</span><span class="p">(</span> <span class="n">v</span> <span class="mi">473</span><span class="s1">&#39;302 (292&#39;</span><span class="mi">200</span><span class="p">,</span><span class="mi">473</span><span class="s1">&#39;302] local-les=473 n=4 ec=5 les/c 473/473 556/556/556</span>
<span class="n">calc_acting</span> <span class="n">osd</span><span class="mf">.1</span> <span class="mf">1.4</span><span class="n">e</span><span class="p">(</span> <span class="n">v</span> <span class="mi">473</span><span class="s1">&#39;302 (293&#39;</span><span class="mi">202</span><span class="p">,</span><span class="mi">473</span><span class="s1">&#39;302] lb 0//0//-1 local-les=477 n=0 ec=5 les/c 473/473 556/556/556</span>
<span class="n">calc_acting</span> <span class="n">osd</span><span class="mf">.4</span> <span class="mf">1.4</span><span class="n">e</span><span class="p">(</span> <span class="n">v</span> <span class="mi">473</span><span class="s1">&#39;302 (120&#39;</span><span class="mi">121</span><span class="p">,</span><span class="mi">473</span><span class="s1">&#39;302] local-les=473 n=4 ec=5 les/c 473/473 556/556/556</span>
<span class="n">calc_acting</span> <span class="n">osd</span><span class="mf">.5</span> <span class="mf">1.4</span><span class="n">e</span><span class="p">(</span> <span class="n">empty</span> <span class="n">local</span><span class="o">-</span><span class="n">les</span><span class="o">=</span><span class="mi">0</span> <span class="n">n</span><span class="o">=</span><span class="mi">0</span> <span class="n">ec</span><span class="o">=</span><span class="mi">5</span> <span class="n">les</span><span class="o">/</span><span class="n">c</span> <span class="mi">473</span><span class="o">/</span><span class="mi">473</span> <span class="mi">556</span><span class="o">/</span><span class="mi">556</span><span class="o">/</span><span class="mi">556</span>
</pre></div>
</div>
<p>since osd.1 is the only one which recorded info.les=477, while osd.4,osd.0
(which were the acting set in that interval) did not (osd.4 restarted and osd.0
did not get the message in time), the PG is marked incomplete when
either osd.4 or osd.0 would have been valid choices. To avoid this, we do not
consider <code class="docutils literal notranslate"><span class="pre">info.les</span></code> for incomplete peers when calculating
<code class="docutils literal notranslate"><span class="pre">min_last_epoch_started_found</span></code>.  It would not have been in the acting
set, so we must have another OSD from that interval anyway (if
<code class="docutils literal notranslate"><span class="pre">maybe_went_rw</span></code>).  If that OSD does not remember that <code class="docutils literal notranslate"><span class="pre">info.les</span></code>, then we
cannot have served reads.</p>
</div>



           </div>
           
          </div>
          <footer>
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
        <a href="../log_based_pg/" class="btn btn-neutral float-right" title="Log Based PG" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
        <a href="../erasure_coding/ecbackend/" class="btn btn-neutral float-left" title="ECBackend 实现策略" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>
        &#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).

    </p>
  </div> 

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>